<div id="musics">
  <h2>Músicas a Venda</h2>
  
  <table>
    <tr>
      <th>Artista</th>
      <th>Música</th>
      <th>Compositor</th>
    </tr>
    
  <% for music in @musics %>
      <tr>
        <td><%= music.artist.name %></td>
        <td><%= music.name %></td>
        <td><%= music.composer_name %></td>
      
          <% unless @current_user.blank? %>
          <td><%= link_to_remote 'Comprar', :url => {:controller => 'users', :action => 'buy', :id => music }, :confirm => "Quer confirmar a compra da música: #{Music.find(music).name} ?", :update => "my_musics" %></td>
        <% else %>
          <td style="text-decoration: line-through;"><%= link_to '(Comprar)', :controller => 'users', :action => 'login' %></td>
        <% end%>
      </tr>
    <% end %>
  </table>
</div>

<div id="my_musics">
  <%= render :partial => 'my_musics' %>
</div>